package com.mlming.springboot.controller;

import com.mlming.springboot.form.CardForm;
import com.mlming.springboot.form.UserForm;
import com.mlming.springboot.pojo.Comment;
import com.mlming.springboot.service.CardService;
import com.mlming.springboot.vo.ResponseVo;
import com.mlming.springboot.vo.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.Mapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class CardController {
    @Autowired
    private CardService cardService;

    @PostMapping("/addCard")
    public ResponseVo addCard(CardForm cardForm) {
        return cardService.addCard(cardForm);
    }

    @GetMapping("/getCardList")
    public ResponseVo getCardList() {
        return cardService.getCardList();
    }

    @GetMapping("/getCard")
    public ResponseVo getCard(Integer id) {
        return cardService.getCard(id);
    }

    @PostMapping("/addPraise")
    public ResponseVo addPraise(Integer id,Integer praises) {
        return cardService.addPraise(id,praises);
    }

    @PostMapping("/addComment")
    public ResponseVo addComments(Integer id, Comment comment) {
        return cardService.addComments(id,comment);
    }
}
